package cn.swust.designpatternlearningplatform.dao;

import cn.swust.designpatternlearningplatform.dao.sql.StudentDaoSql;
import cn.swust.designpatternlearningplatform.domain.bo.DailyExerciseTestNumberBo;
import cn.swust.designpatternlearningplatform.domain.bo.TestPaperDataBo;
import cn.swust.designpatternlearningplatform.domain.entity.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StudentDao {
    @Results(value = {
            @Result(property = "studentName",column = "student_name"),
            @Result(property = "studentNumber",column = "student_number"),
            @Result(property = "studentPassword",column = "student_password"),
            @Result(property = "classNumber",column = "class_number"),
            @Result(property = "schoolTime",column = "school_time"),
            @Result(property = "placeOfClass",column = "place_of_class"),
            @Result(property = "classAndGrade",column = "class_and_grade"),
            @Result(property = "grade",column = "grade"),
            @Result(property = "major",column = "major"),
            @Result(property = "college",column = "college"),
            @Result(property = "reworkMark",column = "rework_mark"),
            @Result(property = "headPortrait",column = "head_portrait"),
            @Result(property = "teacherAccount",column = "teacher_account"),
            @Result(property = "semester",column = "semester"),
    })
   @SelectProvider(type = StudentDaoSql.class,method = "getStudentByNumber")
    Student getStudentByNumber(String number);

    @SelectProvider(type = StudentDaoSql.class,method = "getHeadByStudentNumber")
    String getHeadByStudentNumber(String studentNumber);
    @SelectProvider(type = StudentDaoSql.class,method = "updateHead")
    void updateHead(String studentNumber, String valueOf);
    @SelectProvider(type = StudentDaoSql.class,method = "UploadHead")
    void UploadHead(String studentNumber, String valueOf);
   @SelectProvider(type = StudentDaoSql.class,method = "getHeadPortrait")
    String getHeadPortrait(String studentNumber);
   @Results(value = {
           @Result(property = "topicId",column = "topic_id"),
           @Result(property = "problemTime",column = "problem_time"),
   })
   @SelectProvider(type = StudentDaoSql.class,method = "QueryNumber")
    List<DailyExerciseTestNumberBo> QueryNumber(String studentNumber);
    @SelectProvider(type = StudentDaoSql.class,method = "getAllTypeTopicNumber")
    List<String> getAllTypeTopicNumber(String studentNumber);
    @SelectProvider(type = StudentDaoSql.class,method = "getSelfNumber")
    List<Long> getSelfNumber(String studentNumber);
    @SelectProvider(type = StudentDaoSql.class,method ="getOtherSelfNumber")
    List<Long> getOtherSelfNumber(String studentNumber);
    @Results(value = {
            @Result(property ="teacherNumber",column = "teacher_account"),
            @Result(property ="classNumber",column = "class_number"),
            @Result(property ="semester",column = "semester"),
    })
    @SelectProvider(type = StudentDaoSql.class,method = "getStudentTestPaperData")
    TestPaperDataBo getStudentTestPaperData(String studentNumber);
    @SelectProvider(type = StudentDaoSql.class,method = "getStudentName")
    String getStudentName(String studentNumber);
}
